home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1995…tember: Reference Library / Dev.CD Sep 95 RL / Dev.CD Sep 95 RL.toast / mac / Technical Documentation / develop / develop Issue 18 code / Apple Guide Sample / !Apple Guide article correction next >
Encoding:
Text File  |  1995-01-13  |  1.2 KB  |  19 lines  |  [TEXT/ttxt]

  1. On page 18 of the June 1994 develop article about Apple Guide, it states that
  2.  "The ContextReplyProc should use NewPtr to create a storage area for a short,
  3.  set *ppOutputData to the value of the pointer, and set *pOutputDataSize to
  4.  sizeof(short). Always return a pointer to a short."
  5.  
  6. In fact, Apple Guide uses only the first byte of the value that is returned. The
  7.  *pOutputDataSize value is ignored. The correct statement is "The
  8.  ContextReplyProc should use NewPtr to create a storage area for a Boolean, set
  9.  *ppOutputData to the value of the pointer, and set *pOutputDataSize to
  10.  sizeof(Boolean). Always return a pointer to a Boolean."
  11.  
  12. The MoGuide sample source uses a short, but it is cast to a char when it assigns
  13.  the result. Consequently, the MoGuide example returns the equivalent of a
  14.  Boolean because of the modern miracles of compiler casting. If an engineer
  15.  follows the MoGuide example exactly, the context check will work. However, most
  16.  will return a pointer to the short per the instructions and, since Apple Guide
  17.  uses only the first byte of the short, the result will always be interpreted as
  18.  false. The correct action is to return a pointer to a Boolean.
  19.